/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.jims.master.modules.doctor.netHosptial.service;


import com.jims.master.common.service.CrudService;
import com.jims.master.modules.doctor.netHosptial.dao.NetPrescDao;
import com.jims.master.modules.doctor.netHosptial.entity.NetPresc;
import com.jims.master.modules.doctor.netHosptial.entity.NetPrescMain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 门诊医嘱明细Service
 * @author zp
 * @version 2016-05-31
 */
@Service
@Transactional(readOnly = true)
public class NetPrescService extends CrudService<NetPrescDao, NetPresc> {

    @Autowired
    private NetPrescDao outpPrescDao;

    /**
     * 获取病人每次门诊记录
     * @param patientId
     * @param visitDate
     * @return
     */
    public NetPresc getNetPresc(String patientId,Date visitDate){
        NetPresc outpPresc=outpPrescDao.getNetPresc(patientId, visitDate);
        return outpPresc;
    }

    public  List<NetPresc> selelctNetPresc(String patientId,String visitNo,String visitDate){
        List<NetPresc> outpPrescList=outpPrescDao.selectNetPresc(patientId, visitNo, visitDate);
        return outpPrescList;
    }

    /**
     * 删除所有子记录
     * @return
     */
    public void deleteAll(NetPrescMain outpPrescMain){
        dao.deleteAll(outpPrescMain);
    }

    public List<NetPresc> getNetPrescByMain(NetPresc outpPresc){
        return dao.getNetPrescByMain(outpPresc);
    }
    /**
     * 获取病人处方信息
     * @param patientId
     * @param visitDate
     * @return
     */
    /*public List<NetPresc> list(String patientId,Date visitDate){
        NetPresc outpPresc=outpPrescDao.getNetPresc(patientId, visitDate);
        return outpPresc;
    }*/

    /**
     * 获得患者未传送的信息
     * @return
     */
    public List<NetPresc> getInfoToSend(NetPresc outpPresc){
        return dao.getInfoToSend(outpPresc);
    }
    //改变发送标志
    @Transactional(readOnly = false)
    public Integer send(NetPresc outpPresc){
        return dao.send(outpPresc);
    }

    /***
     * 由处方单号查询处方明细
     * @param outpPresc
     * @return
     */
    public List<NetPresc> getNetPrescByPrescNo(NetPresc outpPresc){
        return dao.getNetPrescByPrescNo(outpPresc);
    }
}